﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;

namespace ActivitiesControl.Repository.DAL.SqlServer
{
    internal abstract class SqlServerBaseRepository<T>
    {
        private SqlConnection connection;

        protected SqlConnection Connection
        {
            get
            {
                if (connection == null)
                    connection = new SqlConnection(ConfigurationManager.ConnectionStrings["main"].ConnectionString);

                return connection;
            }
            set { connection = value; }
        }

        protected abstract T Row2Object(DataRow row);
    }
}
